(function() {

	define(['jquery', 'jbox'], function() {

		$(function() {

			$('.j-tooltip').jBox('Tooltip');

			new jBox('Tooltip', {
				attach: $('.one-goods .info span.other'),
				closeOnMouseleave: true,
				onOpen: function() {

					var array = this.target.attr('content').split('|');
					var html = '';

					switch(array.length) {

						case 3:
							html = '<div class="price">\
										<p>'+ array[0].split(',')[0] + '-' + array[1].split(',')[0] +'双: <em>￥'+ array[0].split(',')[1] +'</em></p>\
										<p>'+ (parseInt(array[1].split(',')[0]) + 1) + '-' + array[2].split(',')[0] +'双: <em>￥'+ array[1].split(',')[1] +'</em></p>\
										<p>>'+ array[2].split(',')[0] +'双: <em>￥'+ array[2].split(',')[1] +'</em></p>\
									</div>';
							break;

						case 2:
							html = '<div class="price">\
										<p>'+ array[0].split(',')[0] + '-' + array[1].split(',')[0] +'双: <em>￥'+ array[0].split(',')[1] +'</em></p>\
										<p>>'+ array[1].split(',')[0] + '双: <em>￥'+ array[1].split(',')[1] +'</em></p>\
									</div>';
							break;

						case 1:
							html = '<div class="price">\
										<p>≥'+ array[0].split(',')[0] + '双: <em>￥'+ array[0].split(',')[1] +'</em></p>\
									</div>';
							break;
					}

					this.content.html(html);
				}
			})
		});
	});
})();